VintaSoft Imaging .NET SDK 14.0: Documentation for .NET developer
Vintasoft.Imaging.Codecs.ImageFiles.Raw Namespace / CrwPage Class / GetThumbnailImage Methods / GetThumbnailImage(EventHandler<ProgressEventArgs>) Method
Syntax Example Requirements SeeAlso
In This Topic
    GetThumbnailImage(EventHandler<ProgressEventArgs>) Method (CrwPage)
    In This Topic
    Returns a thumbnail image associated with this image page.
    Syntax
    'Declaration
    
    Public Overloads Overrides Function GetThumbnailImage( _
    ByVal progressDelegate
    Progress delegate. Can be set to null (Nothing in Visual Basic).
    As System.EventHandler(Of ProgressEventArgs) _
    ) As Vintasoft.Imaging.VintasoftImage

    Parameters

    progressDelegate
    Progress delegate. Can be set to null (Nothing in Visual Basic).

    Return Value

    The thumbnail image associated with this ImagePage object if thumbnail image was loaded successfully; otherwise, null.
    Example

    Here is an example that shows how to open Canon CRW-file, get thumbnail image from CRW-file and save image to a PNG-file:

    
    ''' <summary>
    ''' Opens Canon CRW-file, gets thumbnail image from CRW-file and saves image to a PNG-file.
    ''' </summary>
    ''' <param name="crwFilename">The name of CRW-file.</param>
    Public Sub GetAndSaveCrwThumbnail(crwFilename As String)
        ' open CRW-file stream
        Using fs As New System.IO.FileStream(crwFilename, System.IO.FileMode.Open, System.IO.FileAccess.Read)
            ' open CRW-file
            Dim rawImageFile As New Vintasoft.Imaging.Codecs.ImageFiles.Raw.RawImageFile(fs)
            ' get CRW-page
            Dim crwPage As Vintasoft.Imaging.Codecs.ImageFiles.Raw.CrwPage = TryCast(rawImageFile.Page, Vintasoft.Imaging.Codecs.ImageFiles.Raw.CrwPage)
            ' if CRW-page is found in RAW-file
            If crwPage IsNot Nothing Then
                ' get thumbnail image from CRW-file
                Using cr2Thumbnail As Vintasoft.Imaging.VintasoftImage = crwPage.GetThumbnailImage()
                    ' save image to a PNG file
                    cr2Thumbnail.Save(crwFilename & ".png")
                End Using
            End If
        End Using
    End Sub
    
    
    
    /// <summary>
    /// Opens Canon CRW-file, gets thumbnail image from CRW-file and saves image to a PNG-file.
    /// </summary>
    /// <param name="crwFilename">The name of CRW-file.</param>
    public void GetAndSaveCrwThumbnail(string crwFilename)
    {
        // open CRW-file stream
        using (System.IO.FileStream fs = new System.IO.FileStream(crwFilename, System.IO.FileMode.Open, System.IO.FileAccess.Read))
        {
            // open CRW-file
            Vintasoft.Imaging.Codecs.ImageFiles.Raw.RawImageFile rawImageFile =
                new Vintasoft.Imaging.Codecs.ImageFiles.Raw.RawImageFile(fs);
            // get CRW-page
            Vintasoft.Imaging.Codecs.ImageFiles.Raw.CrwPage crwPage =
                rawImageFile.Page as Vintasoft.Imaging.Codecs.ImageFiles.Raw.CrwPage;
            // if CRW-page is found in RAW-file
            if (crwPage != null)
            {
                // get thumbnail image from CRW-file
                using (Vintasoft.Imaging.VintasoftImage cr2Thumbnail = crwPage.GetThumbnailImage())
                {
                    // save image to a PNG file
                    cr2Thumbnail.Save(crwFilename + ".png");
                }
            }
        }
    }
    
    

    Requirements

    Target Platforms: .NET9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

    See Also